# -*- coding: UTF-8 -*-

from django.views.decorators.csrf import csrf_exempt
from django.views.generic.list_detail import object_detail, object_list
from django.views.generic.create_update import update_object, create_object, delete_object
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.contrib.messages import info, error

from PidaRestauranteWeb.vendas.models import *
from PidaRestauranteWeb.vendas.forms import *

@csrf_exempt
def pedido_list(request, page):
    query_set = Pedido.objects.all().order_by('-data_pedido')
    return object_list(
                       request = request,
                       queryset = query_set,
                       paginate_by = 15,
                       page = page,
                       template_name = 'generic_list.html',
                       extra_context = {'title':u'Lista de pedidos',
                                        'link':'nucleo/pedido',
                                        }
                       )
    
